import { AddRoleModel, RoleModel } from '@/api/system/role/RoleModel'
import { reactive } from 'vue'

export default function useBaseModel() {
    //表单绑定的数据
    const addModel = reactive<RoleModel>({
        id: 0,
        role_name: '',
        type: '',
        remark: '',
        status: '1'
    })
    //表单验证规则
    const rules = reactive({
        parentId: [
            {
                trigger: 'change',
                required: true,
                message: '请选择父级角色'
            }
        ],
        role_name: [
            {
                trigger: 'blur',
                required: true,
                message: '请填写角色名称'
            },
            { min: 2, max: 50, message: '长度为2-50个字符', trigger: 'blur' }
        ]
    })
    return {
        addModel,
        rules
    }
}
